<?php
class Gmapsprofile_Plugin_Task_Geocode extends Core_Plugin_Task_Abstract
{
  public function execute()
  {
    $settings = Engine_Api::_()->getApi('settings', 'core');
    $limit = isset($settings->gmapsprofile_queries) ? $settings->gmapsprofile_queries : 10;
    $lines_update = Engine_Api::_()->gmapsprofile()->geocoding(0, $limit);
	if ($lines_update == "exit") {
	  Engine_Api::_()->getDbtable('tasks', 'core')->delete(array(
		'module = ?' => 'gmapsprofile',
	  ));	  
	  $settings->gmapsprofile_geocode = false;
	}
  }
}